wx.Frame(parent,id=-1,title="",pos=wx.DefaultPosition,size=wx.DefaultSize,style=wx.DEFAULT_FRAME          _STYLE,name="frame")
import wx

class MyFrame(wx.Frame):
    def __init__(self, parent, id):
        wx.Frame.__init__(self,parent,id,title = "创建Frame",pos = (100,100), size= (300,300))

if __name__ == '__main__':
    app = wx.App()
    frame = MyFrame(parent=None, id=-1)
    frame.Show()
    app.MainLoop()
wx.StaticText(parent,id,label,pos=wx.DefaultPosition,size=wx.DefaultSize,style=0,name="staticTex               t")
import wx

class MyFrame(wx.Frame):
    def __init__(self,parent,id):
        wx.Frame.__init__(self,parent,id,title="创建StaticText类",pos=(100,100),size=(600,400))
        panel = wx.Panel(self)#创建画板
        #创建标题，并设置字体
        title = wx.StaticText(panel,label="python",pos=(100,20))
        font = wx.Font(16,wx.DEFAULT,wx.FONTSTYLE_NORMAL,wx.NORMAL)
        title.SetFont(font)
        #创建文本
        wx.StaticText(panel,label='人生苦短，我用python',pos=(50,50))


if __name__ == '__main__':
    app = wx.App()#初始化应用
    frame = MyFrame(parent=None, id=-1)#实例化MyFrame类，并传递参数
    frame.Show()#显示窗口
    app.MainLoop()#调用主循环方法
wx.TextCtrl(parent,id,value="",pos=wx.DefaultPosition,size=wx.DefaultSize,style=0,validator=wx.D             efaultValidator,name=wx.TextCtrlNameStr)
import wx
class MyFrame(wx.Frame):
    def __init__(self,parent,id):
        wx.Frame.__init__(self,parent,id,title="创建",size=(400,300))
        panel=wx.Panel(self)
        self.title=wx.StaticText(panel, label="请输入用户名和密码",pos=(140,20))
        self.label_user=wx.StaticText(panel, label="用户名",pos=(50,50))
        self.label_pwd= wx.StaticText(panel, label="密 码", pos=(50, 90))
        self.text_user=wx.TextCtrl(panel,pos=(100,50),size=(235,25),style=wx.TE_LEFT)
        self.text_user = wx.TextCtrl(panel, pos=(100, 90), size=(235, 25), style=wx.TE_PASSWORD)


if __name__=='__main__':
    app=wx.App()
    frame=MyFrame(parent=None,id=-1)
    frame.Show()
    app.MainLoop()
wx.Button（parent,id,label,pos,size=wxDefaultSize,style=0,validator,name="button"）
import wx
class MyFrame(wx.Frame):
    def __init__(self,parent,id):
        wx.Frame.__init__(self,parent,id,title="创建",size=(400,300))
        panel=wx.Panel(self)
        self.title=wx.StaticText(panel, label="请输入用户名和密码",pos=(140,20))
        self.label_user=wx.StaticText(panel, label="用户名",pos=(50,50))
        self.label_pwd= wx.StaticText(panel, label="密 码", pos=(50, 90))
        self.text_user=wx.TextCtrl(panel,pos=(100,50),size=(235,25),style=wx.TE_LEFT)
        self.text_password = wx.TextCtrl(panel, pos=(100, 90), size=(235, 25), style=wx.TE_PASSWORD)
        #创建“确定”和"取消"按钮
        self.bt_confirm = wx.Button(panel, label='确定',pos=(105,130))
        self.bt_cancel = wx.Button(panel,label='取消',pos=(195,130))


if __name__=='__main__':
    app=wx.App()
    frame=MyFrame(parent=None,id=-1)
    frame.Show()
    app.MainLoop()
import wx
class MyFrame(wx.Frame):
    def __init__(self,parent,id):
        wx.Frame.__init__(self,parent,id,'用户登录',size=(400,300))
        #创建面板
        panel=wx.Panel(self)
        self.title=wx.StaticText(panel, label="请输入用户名和密码")
        #添加容器，容器中控件按纵向排列
        v=wx.BoxSizer(wx.VERTICAL)
        v.Add(self.title,proportion=0,flag=wx.BOTTOM|wx.TOP|wx.ALIGN_CENTER,border=15)
        panel.SetSizer(v)



if __name__=='__main__':
    app=wx.App()
    frame=MyFrame(parent=None,id=-1)
    frame.Show()
    app.MainLoop()
Box_Add(control,proportion,flag,border)
bt_confirm.Bind(wx.EVT_BUTTON,OnclickSubmit)
import wx

class MyFrame(wx.Frame):
    def __init__(self,parent,id):
        wx.Frame.__init__(self,parent,id,'用户登录',size=(400,300))
        #创建面板
        panel = wx.Panel(self)
        #创建确定和取消按钮，并绑定事件
        self.bt_confirm = wx.Button(panel, label='确定', pos=(105, 130))
        self.bt_cancel = wx.Button(panel, label='取消', pos=(195, 130))
        self.bt_confirm.Bind(wx.EVT_BUTTON,self.OnclickSubmit)

        self.bt_cancel.Bind(wx.EVT_BUTTON, self.OnclickCancel)
      

        self.title = wx.StaticText(panel, label="请输入用户名和密码", pos=(140, 20))
        self.label_user = wx.StaticText(panel, label="用户名", pos=(50, 50))
        self.label_pwd = wx.StaticText(panel, label="密 码", pos=(50, 90))
        self.text_user = wx.TextCtrl(panel, pos=(100, 50), size=(235, 25), style=wx.TE_LEFT)
        self.text_password = wx.TextCtrl(panel, pos=(100, 90), size=(235, 25), style=wx.TE_PASSWORD)

    def OnclickSubmit(self,event):
        message=""
        username=self.text_user.GetValue()
        password = self.text_password.GetValue()
        if username=="" or password=="":
            message="用户名或密码不能为空"
        elif username =="mr" or password =="mrsoft":
            message="登陆成功"
        else:
            message="用户名和密码不匹配"
        wx.MessageBox(message)#弹出提示框

    def OnclickCancel(self,event):
        self.text_user.SetValue("")#清空用户框
        self.text_password.SetValue("")#清空密码框


if __name__=="__main__":
    app = wx.App()
    frame = MyFrame(parent=None,id=-1)
    frame.Show()
    app.MainLoop()

